package com.ym.jetpackhilt

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.TextView
import androidx.work.OneTimeWorkRequest
import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.WorkManager
import androidx.work.WorkRequest
import com.ym.jetpackhilt.app.App
import com.ym.jetpackhilt.bean.Dog
import com.ym.jetpackhilt.bean.User
import com.ym.jetpackhilt.work.UploadWorker
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
//    @Inject lateinit var app : App

    @Inject lateinit var user: User
    @Inject lateinit var dog: Dog
//    val uploadWorkRequests: WorkRequest =
//        OneTimeWorkRequestBuilder<UploadWorker>()
//            .build()
//    val uploadWorkRequest = OneTimeWorkRequest.from(UploadWorker::class.java)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
//        Log.e("====", app.toString())
//        WorkManager
//            .getInstance(this)
//            .enqueue(uploadWorkRequest)

        val txt = findViewById<TextView>(R.id.txt)
        dog.name = "泰迪"
//        user.us = " this is miao shu"
        user.id = "1"
        user.name = "chen"
        dog.desc = "made in china"
        Log.e("==========222222=======", "txt")
        Log.e("=================", "txt: $dog")
        txt.setOnClickListener {

            Log.e("=================", "txt: ${user.toString()}")
        }
    }
}